﻿package com.eitb.botones.enlaces {
	import flash.display.*;
	import flash.text.*;
	import flash.events.*;
	import flash.net.*;
	import com.eitb.botones.*;
	import com.eitb.nielsen.*;
	public class Enlace extends MovieClip {
		private var url:URLRequest;
		
		public function Enlace():void {
			this.addEventListener(MouseEvent.MOUSE_DOWN,downBoton);
			this.addEventListener(MouseEvent.CLICK,clickBoton);
			this.addEventListener(MouseEvent.MOUSE_UP,upBoton);
			this.addEventListener(MouseEvent.MOUSE_OVER,overBoton);
			this.addEventListener(MouseEvent.MOUSE_OUT,outBoton);
		}
		
		private function downBoton(event:MouseEvent):void {
			this.gotoAndStop(Boton.SELECCIONADO);
		}
		private function clickBoton(event:MouseEvent):void {
			navigateToURL(this.url, "_blank");
			new NielsenCall("enlace_".concat(this.url.url)).doPing();
		}
		private function upBoton(event:MouseEvent):void {
			this.gotoAndStop(Boton.REPOSO);
			
		}
		private function overBoton(event:MouseEvent):void {
			this.gotoAndStop(Boton.ACTIVO);
		}
		private function outBoton(event:MouseEvent):void {
			this.gotoAndStop(Boton.REPOSO);
		}
		
		public function setUrl(url:URLRequest):void {
			this.url = url;
		}
		
		public function setText(texto:String):void {
			this.pulsar_txt.text = texto;
		}
		
	}
}